home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / MorphOS / tictactoe-1.2.1 / t3visual.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-10-22  |  798 b   |  48 lines

  1. #include <stdio.h>
  2. #include "t3types.h"
  3. #include "messages.h"
  4.  
  5. void show_scores() {
  6.     int row, col;
  7.  
  8.     fprintf(stderr, "\n\n");
  9.     for(row=0; row<SIZE; row++) {
  10.         fprintf(stderr, "\t");
  11.         for(col=0; col<SIZE; col++)
  12.             fprintf(stderr, "%3d\t", scores[row][col]);
  13.         fprintf(stderr, "\n");
  14.     }
  15.     fprintf(stderr, "\n\n");
  16. }
  17.  
  18. void show_board() {
  19.     int row, col;
  20.  
  21.     for(row=0; row<SIZE; row++) {
  22.         for(col=0; col<SIZE; col++)
  23.             printf("%c ", piece[board[row][col]]);
  24.         printf("\n");
  25.     }
  26. }
  27.  
  28. void show_result(enum players result) {
  29.     print_msg("Game over - ");
  30.     switch(result) {
  31.         case O:
  32.             print_msg("O wins\n");
  33.             break;
  34.         case X:
  35.             print_msg("X wins\n");
  36.             break;
  37.         case DRAW:
  38.             print_msg("Drawn\n");
  39.             break;
  40.         case NONE:
  41.             print_msg("No winner\n");
  42.             break;
  43.         default:
  44.             printf("no result\n");
  45.     }
  46. }
  47.  
  48.